package com.hs.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.entity.PubCenter;
import com.hs.mapper.PubCenterMapper;
import com.hs.service.PubCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PubCenterServiceImpl implements PubCenterService {
    @Autowired
    private PubCenterMapper pubCenterMapper;
    @Override
    public Integer addPubCenter(PubCenter pubCenter) {
        return pubCenterMapper.addPubCenter(pubCenter);
    }

    @Override
    public Integer deletePubCenter(Integer id) {
        return pubCenterMapper.deletePubCenter(id);
    }

    @Override
    public Integer updatePubCenter(PubCenter pubCenter) {
        return pubCenterMapper.updatePubCenter(pubCenter);
    }

    @Override
    public PubCenter getPubCenterById(Integer id) {
        return pubCenterMapper.getPubCenterById(id);
    }

    @Override
    public PageInfo<PubCenter> getPubCenterPage(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<PubCenter> list = pubCenterMapper.getPubCenterList();
        PageInfo<PubCenter> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
